load("//:build_variables.bzl", "COPTS")
load("//tools/lint:linters.bzl", "clang_tidy_test")
load("@grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")

package(
    default_visibility = ["//:android_cuttlefish"],
)

proto_library(
    name = "echo_server_proto",
    srcs = ["echo.proto"],
)

cc_proto_library(
    name = "echo_server_cc_proto",
    deps = [":echo_server_proto"],
)

cc_grpc_library(
    name = "libecho_server",
    srcs = [":echo_server_proto"],
    deps = [
        ":echo_server_cc_proto",
        "@grpc//:grpc++",
    ],
    grpc_only = True,
)

cc_binary(
    name = "echo_server",
    srcs = [
        "main.cpp",
    ],
    copts = COPTS,
    deps = [
        ":libecho_server",
        "@gflags",
        "@grpc//:grpc",
        "@grpc//:grpc++",
        "@grpc//:grpc++_reflection",
    ],
)

clang_tidy_test(
    name = "echo_server_clang_tidy",
    srcs = [":echo_server"],
    tags = ["clang_tidy", "clang-tidy"],
)
